package ${package_service_impl};
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lz.common.utils.JWTUtils;
import com.lz.service.*;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
/**
 * <pre>
 * @描述：${Table}的逻辑层
 * @作者：${NAME}
 * @创建时间：${DATE}
 * </pre>
 **/
@Service
public class ${Table}ServiceImpl extends ServiceImpl<${Table}Mapper,${TableEntity}> implements ${Table}Service {


    /**
     * ${Table}构建查询对象
     * @param ${table}
     * @return
     */
    public LambdaQueryWrapper<${TableEntity}> createQueryWrapper(${TableEntity} ${table}){
        LambdaQueryWrapper<${TableEntity}> queryWrapper = new LambdaQueryWrapper<>();
        if(${table}!=null){
            
            <#list models as md>
                <#if (md.name?contains("title") || md.name?contains("name") || md.name?contains("address") )>
                queryWrapper.like(!StringUtils.isEmpty(${table}.get${md.upperName}()),${Table}::${md.lambda_column},${table}.get${md.upperName}());
                <#else>
                 queryWrapper.eq(!StringUtils.isEmpty(${table}.get${md.upperName}()),${Table}::${md.lambda_column},${table}.get${md.upperName}());
                </#if>
            </#list>
        }
        return queryWrapper;
    }

}
